n = input().split()
L = int(n[0])
m = int(n(1))
s= set(n)
s.clear
l = []
r = []
def cheak(x,y):
    for i in range(len(l)):
        if x>l[i] and x<r[i]:
            if y>r[i]:
                y=r[i]
                return
            elif x<l[i]:
                if l[i]>y:
                    l.append(x)
                    r.append(y)
                elif y<l[i]:
                    x=l[i]
                else:
                    x=l[i]
                    y=r[i]
                    return
            else:
                l.append(x)
                r.append(y)
                return


for i in range(0,m):
    li = input().split()
    x = int(n[0])
    y = int(n[1])
    if not l:
        l.append(x)
        r.append(y)
    else:
        cheak(x,y)
        print(i,".")
        print(l)
        print(r)
        print("---")

t=0
g=-1
while len(l)+g>0:
    x = l.pop(g)
    y = r.pop(g)
    s.add(x)
    cheak(x,y)
    if l[g] in s:
        g=g-1

L=L+1
for i in range(len[l]):
    L=L-(r[i]-l[i]+1)
    print(L)
#这个题刚看时比较蒙，只需要将要覆盖线段的两个端点分别放入两个空列表中
#每次有新的端点进来时首先要与原来的段点进行比较，不断地进行检查

